package com.ibm.risk.irmp.workflow.client.flowable.api;

import com.ibm.risk.irmp.workflow.client.flowable.ApiClient;

import com.ibm.risk.irmp.workflow.client.flowable.model.DataResponseTaskResponse;
import com.ibm.risk.irmp.workflow.client.flowable.model.EventResponse;
import java.time.OffsetDateTime;
import com.ibm.risk.irmp.workflow.client.flowable.model.TaskActionRequest;
import com.ibm.risk.irmp.workflow.client.flowable.model.TaskQueryRequest;
import com.ibm.risk.irmp.workflow.client.flowable.model.TaskRequest;
import com.ibm.risk.irmp.workflow.client.flowable.model.TaskResponse;
import com.ibm.risk.irmp.workflow.client.flowable.model.TaskVariableCollectionResource;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;


@Component("com.ibm.risk.irmp.flowable.api.TasksApi")
public class TasksApi {
    private ApiClient apiClient;

    public TasksApi() {
        this(new ApiClient());
    }

    @Autowired
    public TasksApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Create Task
     *
     * <p><b>200</b> - successful operation
     * <p><b>201</b> - Indicates request was successful and the tasks are returned
     * <p><b>400</b> - Indicates a parameter was passed in the wrong format or that delegationState has an invalid value (other than pending and resolved). The status-message contains additional information.
     * @param body The body parameter
     * @return TaskResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public TaskResponse createTask(TaskRequest body) throws RestClientException {
        Object postBody = body;

        String path = UriComponentsBuilder.fromPath("/runtime/tasks").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<TaskResponse> returnType = new ParameterizedTypeReference<TaskResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Create new variables on a task
     * This endpoint can be used in 2 ways: By passing a JSON Body (RestVariable or an Array of RestVariable) or by passing a multipart/form-data Object. It is possible to create simple (non-binary) variable or list of variables or new binary variable  Any number of variables can be passed into the request body array. NB: Swagger V2 specification does not support this use case that is why this endpoint might be buggy/incomplete if used with other tools.
     * <p><b>200</b> - successful operation
     * <p><b>201</b> - Indicates the variables were created and the result is returned.
     * <p><b>400</b> - Indicates the name of a variable to create was missing or that an attempt is done to create a variable on a standalone task (without a process associated) with scope global or an empty array of variables was included in the request or request did not contain an array of variables. Status message provides additional information.
     * <p><b>404</b> - Indicates the requested task was not found.
     * <p><b>409</b> - Indicates the task already has a variable with the given name. Use the PUT method to update the task variable instead.
     * <p><b>415</b> - Indicates the serializable data contains an object for which no class is present in the JVM running the Flowable engine and therefore cannot be deserialized.
     * @param taskId The taskId parameter
     * @param body Create a variable on a task
     * @param name Required name of the variable
     * @param type Type of variable that is created. If omitted, reverts to raw JSON-value type (string, boolean, integer or double)
     * @param scope Scope of variable that is created. If omitted, local is assumed.
     * @return Object
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public Object createTaskVariable(String taskId, TaskVariableCollectionResource body, String name, String type, String scope) throws RestClientException {
        Object postBody = body;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling createTaskVariable");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}/variables").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        if (name != null)
            formParams.add("name", name);
        if (type != null)
            formParams.add("type", type);
        if (scope != null)
            formParams.add("scope", scope);

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = {
            "application/json", "multipart/form-data"
        };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Object> returnType = new ParameterizedTypeReference<Object>() {};
        return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Delete all local variables on a task
     *
     * <p><b>204</b> - Indicates all local task variables have been deleted. Response-body is intentionally empty.
     * <p><b>404</b> - Indicates the requested task was not found.
     * @param taskId The taskId parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void deleteAllLocalTaskVariables(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling deleteAllLocalTaskVariables");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}/variables").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Delete an event on a task
     *
     * <p><b>204</b> - Indicates the task was found and the events are returned.
     * <p><b>404</b> - Indicates the requested task was not found or the task does not have the requested event.
     * @param taskId The taskId parameter
     * @param eventId The eventId parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void deleteEvent(String taskId, String eventId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling deleteEvent");
        }

        // verify the required parameter 'eventId' is set
        if (eventId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'eventId' when calling deleteEvent");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        uriVariables.put("eventId", eventId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}/events/{eventId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Delete a task
     *
     * <p><b>204</b> - Indicates the task was found and has been deleted. Response-body is intentionally empty.
     * <p><b>403</b> - Indicates the requested task cannot be deleted because it’s part of a workflow.
     * <p><b>404</b> - Indicates the requested task was not found.
     * @param taskId The taskId parameter
     * @param cascadeHistory Whether or not to delete the HistoricTask instance when deleting the task (if applicable). If not provided, this value defaults to false.
     * @param deleteReason Reason why the task is deleted. This value is ignored when cascadeHistory is true.
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void deleteTask(String taskId, String cascadeHistory, String deleteReason) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling deleteTask");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "cascadeHistory", cascadeHistory));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "deleteReason", deleteReason));

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.DELETE, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Tasks actions
     *
     * <p><b>200</b> - Indicates the action was executed.
     * <p><b>400</b> - When the body contains an invalid value or when the assignee is missing when the action requires it.
     * <p><b>404</b> - Indicates the requested task was not found.
     * <p><b>409</b> - Indicates the action cannot be performed due to a conflict. Either the task was updates simultaneously or the task was claimed by another user, in case of the claim action.
     * @param taskId The taskId parameter
     * @param body The body parameter
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public void executeTaskAction(String taskId, TaskActionRequest body) throws RestClientException {
        Object postBody = body;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling executeTaskAction");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = { };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
        apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get an event on a task
     *
     * <p><b>200</b> - Indicates the task and event were found and the event is returned.
     * <p><b>404</b> - Indicates the requested task was not found or the tasks does not have an event with the given ID.
     * @param taskId The taskId parameter
     * @param eventId The eventId parameter
     * @return EventResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public EventResponse getEvent(String taskId, String eventId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling getEvent");
        }

        // verify the required parameter 'eventId' is set
        if (eventId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'eventId' when calling getEvent");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        uriVariables.put("eventId", eventId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}/events/{eventId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<EventResponse> returnType = new ParameterizedTypeReference<EventResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a task
     *
     * <p><b>200</b> - Indicates the task was found and returned.
     * <p><b>404</b> - Indicates the requested task was not found.
     * @param taskId The taskId parameter
     * @return TaskResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public TaskResponse getTask(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling getTask");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<TaskResponse> returnType = new ParameterizedTypeReference<TaskResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Get a task form
     *
     * <p><b>200</b> - Indicates request was successful and the task form is returned
     * <p><b>404</b> - Indicates the requested task was not found.
     * @param taskId The taskId parameter
     * @return String
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public String getTaskForm(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling getTaskForm");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}/form").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<String> returnType = new ParameterizedTypeReference<String>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List events for a task
     *
     * <p><b>200</b> - Indicates the task was found and the events are returned.
     * <p><b>404</b> - Indicates the requested task was not found.
     * @param taskId The taskId parameter
     * @return List&lt;EventResponse&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<EventResponse> listTaskEvents(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling listTaskEvents");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}/events").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<EventResponse>> returnType = new ParameterizedTypeReference<List<EventResponse>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List of sub tasks for a task
     *
     * <p><b>200</b> - Indicates request was successful and the  sub tasks are returned
     * <p><b>404</b> - Indicates the requested task was not found.
     * @param taskId The taskId parameter
     * @return List&lt;TaskResponse&gt;
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public List<TaskResponse> listTaskSubtasks(String taskId) throws RestClientException {
        Object postBody = null;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling listTaskSubtasks");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}/subtasks").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<List<TaskResponse>> returnType = new ParameterizedTypeReference<List<TaskResponse>>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * List of tasks
     *
     * <p><b>200</b> - Indicates request was successful and the tasks are returned
     * <p><b>404</b> - Indicates a parameter was passed in the wrong format or that delegationState has an invalid value (other than pending and resolved). The status-message contains additional information.
     * @param name Only return models with the given version.
     * @param nameLike Only return tasks with a name like the given name.
     * @param description Only return tasks with the given description.
     * @param priority Only return tasks with the given priority.
     * @param minimumPriority Only return tasks with a priority greater than the given value.
     * @param maximumPriority Only return tasks with a priority lower than the given value.
     * @param assignee Only return tasks assigned to the given user.
     * @param assigneeLike Only return tasks assigned with an assignee like the given value.
     * @param owner Only return tasks owned by the given user.
     * @param ownerLike Only return tasks assigned with an owner like the given value.
     * @param unassigned Only return tasks that are not assigned to anyone. If false is passed, the value is ignored.
     * @param delegationState Only return tasks that have the given delegation state. Possible values are pending and resolved.
     * @param candidateUser Only return tasks that can be claimed by the given user. This includes both tasks where the user is an explicit candidate for and task that are claimable by a group that the user is a member of.
     * @param candidateGroup Only return tasks that can be claimed by a user in the given group.
     * @param candidateGroups Only return tasks that can be claimed by a user in the given groups. Values split by comma.
     * @param involvedUser Only return tasks in which the given user is involved.
     * @param taskDefinitionKey Only return tasks with the given task definition id.
     * @param taskDefinitionKeyLike Only return tasks with a given task definition id like the given value.
     * @param taskDefinitionKeys Only return tasks with the given task definition ids.
     * @param processInstanceId Only return tasks which are part of the process instance with the given id.
     * @param processInstanceIdWithChildren Only return tasks which are part of the process instance and its children with the given id.
     * @param processInstanceBusinessKey Only return tasks which are part of the process instance with the given business key.
     * @param processInstanceBusinessKeyLike Only return tasks which are part of the process instance which has a business key like the given value.
     * @param processDefinitionId Only return tasks which are part of a process instance which has a process definition with the given id.
     * @param processDefinitionKey Only return tasks which are part of a process instance which has a process definition with the given key.
     * @param processDefinitionKeyLike Only return tasks which are part of a process instance which has a process definition with a key like the given value.
     * @param processDefinitionName Only return tasks which are part of a process instance which has a process definition with the given name.
     * @param processDefinitionNameLike Only return tasks which are part of a process instance which has a process definition with a name like the given value.
     * @param executionId Only return tasks which are part of the execution with the given id.
     * @param createdOn Only return tasks which are created on the given date.
     * @param createdBefore Only return tasks which are created before the given date.
     * @param createdAfter Only return tasks which are created after the given date.
     * @param dueOn Only return tasks which are due on the given date.
     * @param dueBefore Only return tasks which are due before the given date.
     * @param dueAfter Only return tasks which are due after the given date.
     * @param withoutDueDate Only return tasks which do not have a due date. The property is ignored if the value is false.
     * @param excludeSubTasks Only return tasks that are not a subtask of another task.
     * @param active If true, only return tasks that are not suspended (either part of a process that is not suspended or not part of a process at all). If false, only tasks that are part of suspended process instances are returned.
     * @param includeTaskLocalVariables Indication to include task local variables in the result.
     * @param includeProcessVariables Indication to include process variables in the result.
     * @param scopeDefinitionId Only return tasks with the given scopeDefinitionId.
     * @param scopeId Only return tasks with the given scopeId.
     * @param scopeType Only return tasks with the given scopeType.
     * @param tenantId Only return tasks with the given tenantId.
     * @param tenantIdLike Only return tasks with a tenantId like the given value.
     * @param withoutTenantId If true, only returns tasks without a tenantId set. If false, the withoutTenantId parameter is ignored.
     * @param candidateOrAssigned Select tasks that has been claimed or assigned to user or waiting to claim by user (candidate user or groups).
     * @param category Select tasks with the given category. Note that this is the task category, not the category of the process definition (namespace within the BPMN Xml).
     * @return DataResponseTaskResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public DataResponseTaskResponse listTasks(String name, String nameLike, String description, String priority, String minimumPriority, String maximumPriority, String assignee, String assigneeLike, String owner, String ownerLike, String unassigned, String delegationState, String candidateUser, String candidateGroup, String candidateGroups, String involvedUser, String taskDefinitionKey, String taskDefinitionKeyLike, String taskDefinitionKeys, String processInstanceId, String processInstanceIdWithChildren, String processInstanceBusinessKey, String processInstanceBusinessKeyLike, String processDefinitionId, String processDefinitionKey, String processDefinitionKeyLike, String processDefinitionName, String processDefinitionNameLike, String executionId, OffsetDateTime createdOn, OffsetDateTime createdBefore, OffsetDateTime createdAfter, OffsetDateTime dueOn, OffsetDateTime dueBefore, OffsetDateTime dueAfter, Boolean withoutDueDate, Boolean excludeSubTasks, Boolean active, Boolean includeTaskLocalVariables, Boolean includeProcessVariables, String scopeDefinitionId, String scopeId, String scopeType, String tenantId, String tenantIdLike, Boolean withoutTenantId, String candidateOrAssigned, String category) throws RestClientException {
        Object postBody = null;

        String path = UriComponentsBuilder.fromPath("/runtime/tasks").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "name", name));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "nameLike", nameLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "description", description));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "priority", priority));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "minimumPriority", minimumPriority));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "maximumPriority", maximumPriority));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "assignee", assignee));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "assigneeLike", assigneeLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "owner", owner));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "ownerLike", ownerLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "unassigned", unassigned));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "delegationState", delegationState));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "candidateUser", candidateUser));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "candidateGroup", candidateGroup));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "candidateGroups", candidateGroups));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "involvedUser", involvedUser));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDefinitionKey", taskDefinitionKey));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDefinitionKeyLike", taskDefinitionKeyLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "taskDefinitionKeys", taskDefinitionKeys));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceId", processInstanceId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceIdWithChildren", processInstanceIdWithChildren));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceBusinessKey", processInstanceBusinessKey));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processInstanceBusinessKeyLike", processInstanceBusinessKeyLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionId", processDefinitionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionKey", processDefinitionKey));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionKeyLike", processDefinitionKeyLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionName", processDefinitionName));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "processDefinitionNameLike", processDefinitionNameLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "executionId", executionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "createdOn", createdOn));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "createdBefore", createdBefore));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "createdAfter", createdAfter));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "dueOn", dueOn));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "dueBefore", dueBefore));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "dueAfter", dueAfter));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "withoutDueDate", withoutDueDate));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "excludeSubTasks", excludeSubTasks));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "active", active));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "includeTaskLocalVariables", includeTaskLocalVariables));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "includeProcessVariables", includeProcessVariables));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeDefinitionId", scopeDefinitionId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeId", scopeId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "scopeType", scopeType));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tenantId", tenantId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "tenantIdLike", tenantIdLike));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "withoutTenantId", withoutTenantId));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "candidateOrAssigned", candidateOrAssigned));
        queryParams.putAll(apiClient.parameterToMultiValueMap(null, "category", category));

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<DataResponseTaskResponse> returnType = new ParameterizedTypeReference<DataResponseTaskResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Query for tasks
     * All supported JSON parameter fields allowed are exactly the same as the parameters found for getting a collection of tasks (except for candidateGroupIn which is only available in this POST task query REST service), but passed in as JSON-body arguments rather than URL-parameters to allow for more advanced querying and preventing errors with request-uri’s that are too long. On top of that, the query allows for filtering based on task and process variables. The taskVariables and processInstanceVariables are both JSON-arrays containing objects with the format as described here.
     * <p><b>200</b> - Indicates request was successful and the tasks are returned.
     * <p><b>400</b> - Indicates a parameter was passed in the wrong format or that delegationState has an invalid value (other than pending and resolved). The status-message contains additional information.
     * @param body The body parameter
     * @return DataResponseTaskResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public DataResponseTaskResponse queryTasks(TaskQueryRequest body) throws RestClientException {
        Object postBody = body;

        String path = UriComponentsBuilder.fromPath("/query/tasks").build().toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<DataResponseTaskResponse> returnType = new ParameterizedTypeReference<DataResponseTaskResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
    /**
     * Update a task
     * All request values are optional. For example, you can only include the assignee attribute in the request body JSON-object, only updating the assignee of the task, leaving all other fields unaffected. When an attribute is explicitly included and is set to null, the task-value will be updated to null. Example: {\&quot;dueDate\&quot; : null} will clear the duedate of the task).
     * <p><b>200</b> - Indicates the task was updated.
     * <p><b>404</b> - Indicates the requested task was not found.
     * <p><b>409</b> - Indicates the requested task was updated simultaneously.
     * @param taskId The taskId parameter
     * @param body The body parameter
     * @return TaskResponse
     * @throws RestClientException if an error occurs while attempting to invoke the API
     */
    public TaskResponse updateTask(String taskId, TaskRequest body) throws RestClientException {
        Object postBody = body;

        // verify the required parameter 'taskId' is set
        if (taskId == null) {
            throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'taskId' when calling updateTask");
        }

        // create path and map variables
        final Map<String, Object> uriVariables = new HashMap<String, Object>();
        uriVariables.put("taskId", taskId);
        String path = UriComponentsBuilder.fromPath("/runtime/tasks/{taskId}").buildAndExpand(uriVariables).toUriString();

        final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
        final HttpHeaders headerParams = new HttpHeaders();
        final MultiValueMap<String, Object> formParams = new LinkedMultiValueMap<String, Object>();

        final String[] accepts = {
            "application/json"
        };
        final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
        final String[] contentTypes = { };
        final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);

        String[] authNames = new String[] { "basicAuth" };

        ParameterizedTypeReference<TaskResponse> returnType = new ParameterizedTypeReference<TaskResponse>() {};
        return apiClient.invokeAPI(path, HttpMethod.PUT, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType);
    }
}
